package com.nsn.auction.dao.impl;

import java.util.List;

import com.nsn.auction.dao.ItemDao;
import com.nsn.auction.domina.Item;
import com.nsn.auction.util.CustomHibernateDaoSupport;

public class ItemDaoImpl extends CustomHibernateDaoSupport implements ItemDao {

	@Override
	public void save(Item item) {
		getHibernateTemplate().save(item);

	}

	@Override
	public void update(Item item) {
		getHibernateTemplate().update(item);

	}

	@Override
	public void delete(Item item) {
		getHibernateTemplate().delete(item);

	}

	@Override
	public Item findItemById(Long itemId) {
		List<Item> list = getHibernateTemplate().find("from Item where itemId=?", itemId);
		if (list.size() == 0)
			return null;
		else
			return list.get(0);
	}

}
